import 'package:awak/common/models/user.dart';
import 'package:awak/page/community/community_page.dart';
import 'package:awak/page/community/creation_room_page.dart';
import 'package:awak/page/community/detail_content_page.dart';
import 'package:awak/page/community/detail_room_page.dart';
import 'package:awak/page/community/detail_topic_page.dart';
import 'package:awak/page/community/content_release_page.dart';
import 'package:awak/page/home/add_goal_page.dart';
import 'package:awak/page/home/add_plan_page.dart';
import 'package:awak/page/home/detail_plan_page.dart';
import 'package:awak/common/models/plan.dart';
import 'package:awak/page/home/home_page.dart';
import 'package:awak/page/home/my_plan_page.dart';
import 'package:awak/page/login/login_page.dart';
import 'package:awak/page/login/register_page.dart';
import 'package:awak/page/profile/chat_profile_page.dart';
import 'package:awak/page/profile/collect_profile_page.dart';
import 'package:awak/page/profile/edit_profile.dart';
import 'package:awak/page/profile/issue_profile_page.dart';
import 'package:awak/page/profile/message_profile_page.dart';
import 'package:awak/page/profile/other_profile_page.dart';
import 'package:awak/page/profile/profile_page.dart';
import 'package:awak/page/statistic/statistic_page.dart';
import 'package:awak/common/models/room.dart';
import 'package:beamer/beamer.dart';
import 'package:awak/page/main.dart';
import 'package:awak/page/splash/splash_page.dart';
import 'router_names.dart';

final routerDelegate = BeamerDelegate(
  initialPath: RouterNames.splash,
  locationBuilder: RoutesLocationBuilder(
    routes: {
      // 启动页
      RouterNames.splash: (context, state, data) => const SplashPage(),
      // 登录
      RouterNames.login: (context, state, data) => LoginPage(),
      // 注册
      RouterNames.register: (context, state, data) => const RegisterPage(),
      // 主页
      RouterNames.main: (context, state, data) => const MainPage(),
      // 首页
      RouterNames.home: (context, state, data) => const HomePage(),
      // 添加计划
      RouterNames.addPlan: (context, state, data) => const AddPlanPage(),
      // 计划详情
      RouterNames.detailPlan: (context, state, data) => DetailPlanPage(plan: data as Plan?),
      // 我的计划
      RouterNames.myPlan: (context, state, data) => const MyPlanPage(),
      // 添加目标
      RouterNames.addGoal: (context, state, data) => const AddGoalPage(),
      // 统计
      RouterNames.statistics: (context, state, data) => const StatisticPage(),
      // 社区
      RouterNames.community: (context, state, data) => const CommunityPage(),
      // 发布
      RouterNames.creationRoom: (context, state, data) => const CreationRoomPage(),
      // 房间详情
      RouterNames.detailRoom: (context, state, data) => DetailRoomPage(room: data as Room?),
      // 主题详情
      RouterNames.detailTopic: (context, state, data) => DetailTopicPage(),
      // 内容详情
      RouterNames.detailContent: (context, state, data) => DetailContentPage(),
      // 发布内容
      RouterNames.releaseContent: (context, state, data) => const ContentReleasePage(),
      // 个人中心
      RouterNames.profile: (context, state, data) => const ProfilePage(),
      // 编辑个人资料
      RouterNames.editProfile: (context, state, data) => const EditProfilePage(),
      // 个人中心发布的帖子
      RouterNames.issueProfile: (context, state, data) => const IssueProfilePage(),
      // 个人中心收藏的帖子
      RouterNames.collectProfile: (context, state, data) => const CollectProfilePage(),
      // 其他用户个人中心
      RouterNames.otherProfile: (context, state, data) => const OtherProfilePage(),
      // 聊天
      RouterNames.chatProfile: (context, state, data) => ChatProfilePage(otherUser: data as User),
      // 消息
      RouterNames.messageProfile: (context, state, data) => const MessageProfilePage(),
    },
  ),
);
